package com.xiaofu.sort.bubble;

import com.xiaofu.sort.Sort;

/**
 * @author: xiaofu
 * @DESCRIPTION: a technology seeker
 * @date: 2021-08-02 0:29
 */
public class BubbleSort1 extends Sort {
    @Override
    protected void sort() {
        for (int end = array.length - 1; end > 0; end--) {
            for (int begin = 1; begin <= end; begin++) {
                if (cmp(begin,begin-1) < 0) {
                    swap(begin,begin-1);
                }
            }
        }
    }
}
